import DB from "./indexDB";
const tableFiles = require.context('./table', true, /\.ts$/);
const idb = function ({dbName,version,tables}) {
  const db = new DB({
    dbName,
    version
  });
  for (let tableItem of tables) {
    db.table.push(tableItem);
  }
  return db;
};
const myDB = idb({
  dbName: 'appMainData',
  version: 1010,
  tables: tableFiles.keys().map(key => {
    return tableFiles(key).default||tableFiles(key);
  })
});
window.myMainDb = myDB;
export default myDB;